import React, { useState,useEffect } from 'react';
import { Button, DatePicker, Form, Input } from 'antd';
import * as service from "../../../api/index"


const onFinish = async (values: any) => {
    console.log('Success:', values);
    //在这里拿到数据去发添加数据的请求

 
    
    // var res = await service.banshi_add({ BS: 1, department: values.department, type: values.type, headline: values.headline, content: values.content, name: values.name, phone: values.phone, time:values.time.$y+"-"+(values.time.$M+1)+"-"+values.time.$D})
    // console.log(res)
};

const onFinishFailed = (errorInfo: any) => {
    console.log('Failed:', errorInfo);
};

const { RangePicker } = DatePicker;

interface Props {

}

function Guanliadd(props: Props) {


    const list= async ()=>{
        // var res= await service.banshi_list()
        // console.log(res)
    }
    useEffect(()=>{
        list()
    },[])
    return (
        <div>

            <Form
                name="basic"
                labelCol={{ span: 8 }}
                wrapperCol={{ span: 16 }}
                style={{ maxWidth: 600 }}
                initialValues={{ remember: true }}
                onFinish={onFinish}
                onFinishFailed={onFinishFailed}
                autoComplete="off"
            >
                <Form.Item
                    label="受理部门"
                    name="department"
                    rules={[{ required: true, message: 'Please input your username!' }]}
                >
                    <Input />
                </Form.Item>
                <Form.Item
                    label="类型"
                    name="type"
                    rules={[{ required: true, message: 'Please input your username!' }]}
                >
                    <Input />
                </Form.Item>
                <Form.Item
                    label="标题"
                    name="headline"
                    rules={[{ required: true, message: 'Please input your username!' }]}
                >
                    <Input />
                </Form.Item>
                <Form.Item
                    label="内容"
                    name="content"
                    rules={[{ required: true, message: 'Please input your username!' }]}
                >
                    <Input />
                </Form.Item>
                <Form.Item
                    label="联系人名字"
                    name="name"
                    rules={[{ required: true, message: 'Please input your username!' }]}
                >
                    <Input />
                </Form.Item>
                <Form.Item
                    label="电话"
                    name="phone"
                    rules={[{ required: true, message: 'Please input your username!' }]}
                >
                    <Input />
                </Form.Item>
                <Form.Item name="time" label="办事时间">
                    <DatePicker />
                </Form.Item>
                <Form.Item wrapperCol={{ offset: 8, span: 16 }}>
                    <Button type="primary" htmlType="submit">
                         添加
                    </Button>
                </Form.Item>
            </Form>
        </div>
    );
}

export default Guanliadd;